/** 
 * @Title: Dept.java 
 * @Package com.prs.um.deptmanager.dto 
 * @Description: TODO 
 * @author flybonew@163.com 
 * @date 2013-1-7 下午3:10:29 
 * @version V1.0 
 */  
package com.prs.um.deptmanager.dto;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.prs.um.usermanager.dto.User;

/** 
 * @ClassName: Dept 
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @author flybonew@163.com
 * @date 2013-1-7 下午3:10:29 
 * 
 */
@Table(name="SYSTEM_DEPT")
@Entity
public class Dept implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name = "ID_",length=36)
	@GenericGenerator(name="uuid",strategy="uuid")
	@GeneratedValue(generator="uuid")
	private String id;
	
	@Column(name="USER_NAME_",length=50)
	private String name;
	
	@Column(name="INDEX_")
	private Integer index;
	
	@Column(name="DESCRIPTION_",length=1000)
	private String description;
	
	@ManyToMany(cascade= CascadeType.ALL)
	@JoinTable(name="T_DEPT_USER",joinColumns=@JoinColumn(name="DEPT_ID_"),
	inverseJoinColumns=@JoinColumn(name="USER_ID_"))
	private Set<User> deptMember;
	
	@ManyToMany(cascade= CascadeType.ALL)
	@JoinTable(name="T_DEPT_LEADER",joinColumns=@JoinColumn(name="DEPT_ID_"),
	inverseJoinColumns=@JoinColumn(name="USER_ID_"))
	private Set<User> deptLeader;

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the index
	 */
	public Integer getIndex() {
		return index;
	}

	/**
	 * @param index the index to set
	 */
	public void setIndex(Integer index) {
		this.index = index;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the deptMember
	 */
	public Set<User> getDeptMember() {
		return deptMember;
	}

	/**
	 * @param deptMember the deptMember to set
	 */
	public void setDeptMember(Set<User> deptMember) {
		this.deptMember = deptMember;
	}

	/**
	 * @return the deptLeader
	 */
	public Set<User> getDeptLeader() {
		return deptLeader;
	}

	/**
	 * @param deptLeader the deptLeader to set
	 */
	public void setDeptLeader(Set<User> deptLeader) {
		this.deptLeader = deptLeader;
	}
	
}
